<template>
  <el-dropdown style="margin-right: 15px" @command="handleCommand">
    <div>
      <svg-icon style="color: #fff; font-size: 20px" icon-class="language" />
    </div>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="zh">中文</el-dropdown-item>
      <el-dropdown-item command="en">en</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
export default {
  methods: {
    handleCommand(type) {
      console.log(type) // zh / en
      // 点击的时候需要切换中英文的环境
      // 核心：修改 locale 配置

      this.$i18n.locale = type
    }
  }
}
</script>
